{{extend 'layout.html'}}

<script type="text/javascript">
     $(document).ready(function(){
    	 $("#dialog-confirm").dialog({ autoOpen: false });         
	});

	function delete_language(lang_id) {	  
   	  $("#dialog-confirm").dialog("open");
   	  $("#dialog-confirm").dialog({
   		  autoOpen: false,
   		  modal:true,

   		  buttons : {
   			"Yes" : function() {              
   				$(this).dialog("close");
   				// get call:
   				window.location.href='delete_language/' + lang_id;
   				return   				   	   			    			   				       			
   			},
   			"No" : function() {
   				$(this).dialog("close");
   			}
   		  }
   	  });	  	  
   	}
  	
</script>
<br/>
<br/>
<div id="dialog-confirm" title="Confirm">
	{{=T('Are you sure you want to delete the language with all its items?')}} 
</div>
<table style="border-collapse: separate; border-spacing: 5px">
  <tr>
    <th style="width: 50px">{{=T('Code')}}</th>
    <th style="width: 250px">{{=T('Language')}}</th>
    <th></th>
    <th></th>
  </tr>
  <tr>
  {{for i,row in enumerate(languages):}}
  	{{=TR(
  			TD(row.code),
  			TD(row.description),
  			TD(
  				A(
                      IMG(_src=URL( request.application , 'static/images', 'application_edit.png')), _href=URL('index/%s' %row.id)) 
  			),
  			TD(
  				A(
                      IMG(_src=URL( request.application , 'static/images', 'cancel.png')), _href='#' , _onclick='delete_language(\'%s\')' %row.id) 
  			),
  			_class='even' if not i%2 else 'odd')
  	}}
  {{pass}}

  </tr>
</table>

<br/>
{{=form}}